package cn.hy.today;

class Solution_70 {

    // f(n) = f(n-1) + f(n-2)
    public int climbStairs(int n) {
        //初始值 跳0阶的方案是1种
        int p = 0, q = 0, r = 1;
        for (int i = 1; i <= n; i++) {
            p = q;
            q = r;
            r = p + q;
        }
        return r;
    }
}